<div component="composer" class="composer resizable reply" cid="{$cid}" style="visibility: visible;">
	<div class="composer-container">
		<nav class="navbar navbar-fixed-top mobile-navbar visible-xs visible-sm">
			<div class="pull-left">
				<a class="btn btn-sm btn-primary composer-discard" style="font-size:20px;" data-action="discard" tabindex="-1" href="{$WEBPATH}/bbs/{$bid}"><i class="fa fa-times"></i></a>
			</div>
			<div class="pull-right">
				<button class="btn btn-sm btn-primary composer-submit" data-action="post" tabindex="5"><i class="fa fa-chevron-right"></i></button>
			</div>
			<h4 class="title">编辑 "{$bbstitle}"</h4>
		</nav>
		<div class="row title-container">
		    
			<div class="col-lg-12 col-md-12">
			    
				<span class="title form-control">编辑 "{$bbstitle}"</span>
				
			</div>
			
		</div>
		<div class="category-tag-row">
		    <div class="form-control" style="padding-bottom: 3em;text-align: center;padding-top: 1em;font-size: 1.4em;">
		        <span class="help">标题 <i class="fa fa-fw fa fa-pencil"></i></span>
                <input type="text" style="width: 80%;padding-left: 1em;" name="title" id="title" value="{$bbstitle}">
            </div>
			<div class="btn-toolbar formatting-bar">
				<div class="btn-group pull-right action-bar hidden-sm hidden-xs">
					<a class="btn btn-default composer-discard" data-action="discard" tabindex="-1" href="{$WEBPATH}/cate/{$cid}"><i class="fa fa-times"></i> 撤销</a>

					<button class="btn btn-primary composer-submit" data-action="post"><i class="fa fa-check"></i> 提交</button>
				</div>
				
			</div>
		</div>
        <div id="editor"></div>
	</div>
</div>
<script type="text/javascript">
    var editor=loadEditor("editor");
    Ajax("{$WEBPATH}/api/bbs/view","id={$bid}",function(res){
        editor.ready(function(){
            editor.setContent(res.data.content);
        });
    });
</script>
<script>
$('[data-action="discard"]').click(function(){
    $('[component="composer"]').css("visibility","hidden");
});
$('[data-action="post"]').click(function(){
    var title=$('#title').val();
    var data={content:editor.getContent(),title:title,bid:{$bid}};
    Ajax("{$WEBPATH}/api/bbs/edit",data,function(res){
            layer.msg(res.msg);
            if(res.code==200){
                $('[component="composer"]').css("visibility","hidden");
                window.location.href="{$WEBPATH}/bbs/{$bid}";
            }
    });
});
$('[class="btn btn-primary waves-effect waves-button"]').click(function(obj){//发布帖子
    $('[component="composer"]').css("visibility","visible");
});
</script>